package com.foreknow.demo25;

import java.io.Serializable;

/**
 * 如果想要将Employee的对象保存到一个二进制文件中，那么一定要让这个类实现一个接口Serializable
 * 实现具有序列化能力的类(把对象变为二进制数据流)
 */
public class Employee implements Serializable {
  private String name;
  private int age;
  private String dept;

  public Employee(String name,int age,String dept) {
    this.name = name;
    this.age = age;
    this.dept = dept;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public String getDept() {
    return dept;
  }

  public void setDept(String dept) {
    this.dept = dept;
  }

  public void showInfo() {
    System.out.println("name:"+name+"  age:"+age+"   dept:"+dept);
  }
}
